var 
  logger = require('log4js').getLogger(),
  extend = require('util')._extend,
  yaml = require('js-yaml');




var _env = ''; //current env mode 
var _cfg = {}; //current configuration


exports.init = function (file){
  var allCfg = yaml.safeLoad(file); //all config
  _env = allCfg.env || 'dev';
  _cfg = extend({}, allCfg.config[_env]);
  _cfg.env = _env;
  logger.debug('server config is :\n' + require('util').inspect(_cfg,{colors:true,depth:10}));
};


exports.getCfg = function(){
  return _cfg;
};